package io.renren.config;  // 或者其它你想要放置的包

import io.renren.modules.tbposition.dao.TbPositionDao;
import io.renren.modules.tbposition.service.PosWebSocketService;
import io.renren.modules.testrestful.service.impl.UsersServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class PosConnectionRunner implements ApplicationRunner {

    private final PosWebSocketService posWebSocketService;

    @Autowired
    TbPositionDao tbPositionDao;

    @Autowired
    public PosConnectionRunner(PosWebSocketService posWebSocketService) {
        this.posWebSocketService = posWebSocketService;
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        posWebSocketService.sendMessage(tbPositionDao.getTbPos().toString());
    }
}
